<%@page import="tianqi.entity.UserY"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
	System.out.println("basePath: "+basePath);
	
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>田奇-支付</title>
    <link rel="stylesheet" type="text/css" charset="utf-8" href="css/orderSubmit.css">
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <script type="text/javascript" charset="utf-8" src="js/jquery-1.11.3.js"></script>
    <script type="text/javascript" charset="utf-8" src="js/bootstrap.min.js"></script>
    
    
</head>
<body>
	<div class="container" style="width:1211px;margin:0 auto;">
		<div class="col-md-5 col-md-offset-5">
						<h1>某宝 支付系统</h1>
		</div>
		<c:choose>
   				<c:when test="${msg1!=null}"> 
   					<div class="col-md-5 col-md-offset-5">
						<h1>${msg1 } 您好！ 欢迎光临某宝支付</h1>
					</div>
   				</c:when>
			</c:choose>
	
	<form class="form-horizontal col-md-6 col-md-offset-3" action="">
  <div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label">金额:</label>
    <div class="col-sm-10">
      <input id="mon" name="money" type="text" class="form-control" id="inputEmail3" placeholder="0">
      <input id="mnamee" name="mname" type="hidden" value="${zfb.mname }">
    </div>
  </div>
  
  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <a class="btn btn-success" href="javascript:tj();">提交</a>
    </div>
  </div>
</form>
		
	</div>
<script type="text/javascript" charset="utf-8">
	
	
	function tj(){
		alert("sds");
		 $.ajax({
			    type:"post",
			    url:"${pageContext.request.contextPath}/toPay.tq",
			    data:{
			    	mname:$("#mnamee").val(),
			    	money:$("#mon").val()
			    	
			    },
			    success:function(res){
			      console.log(res);
			      if(res == "true"){
			    	  
			    	  alert("恭喜"+$("#mnamee").val()+"支付成功！3秒后跳转至订单页");
			          setTimeout(function(){location.href="${pageContext.request.contextPath}/tosubmitOrder.tq"},2500);
			      }else{
			        $("#uname_p").css({display:"none"});
			      }
			    },
			    error:function(res){
			      alert(res);
			    }
			  })
			
	}
</script>
</body>
</html>